package com.zxl.live.screen.screen.utils;

import android.content.Context;
import android.graphics.Camera;
import android.graphics.Matrix;

import com.zxl.live.screen.screen.ui.widget.panel.ScreenPanel;
import com.zxl.live.screen.screen.ui.widget.panel.ScreenSpirit;

import java.util.List;
import java.util.Random;

public class FlowerFactory {
	
	private Context mContext;
	private Random mRandom;
	private Matrix mMatrix;
	private Camera mCamera;

	private ScreenPanel mScreenPanel;
	
	public FlowerFactory(ScreenPanel mScreenPanel, Context mContext) {
		this.mScreenPanel = mScreenPanel;
		this.mContext = mContext;
		mRandom = new Random();
		mMatrix = new Matrix();
		mCamera = new Camera();
	}

	public void createFlowers(int type, int size) {
		List<ScreenSpirit> mList = null;
		int flowerSize = size * 10 + 25;
		switch (type) {
		case ScreenSaveUtils.TYPE_SAKURA:
			mList = Global.createRedSakura(mContext, mCamera, mMatrix, mRandom, flowerSize);
			break;
		case ScreenSaveUtils.TYPE_SNOW:
			mList = Global.createSnow(mContext, mRandom, flowerSize);
			break;
		case ScreenSaveUtils.TYPE_TAOHUA:
			mList = Global.createTaohua(mContext, mCamera, mMatrix, mRandom, flowerSize);
			break;
		case ScreenSaveUtils.TYPE_ROSE:
			mList = Global.createRose(mContext, mCamera, mMatrix, mRandom, flowerSize);
			break;
		case ScreenSaveUtils.TYPE_DANDELION:
			flowerSize = size * 3 + 10;
			mList = Global.createDandelion(mContext,mRandom, flowerSize);
			break;
		case ScreenSaveUtils.TYPE_HEART_ROSE:
			mList = Global.createHeartRose(mContext, mCamera, mMatrix, mRandom, flowerSize);
			break;
		default:
			break;
		}
		if (null != mList) {
			mScreenPanel.resetData(mList);
		}
	}
	
}
